<?php if (!defined('BASEPATH')) exit('No direct script access allowed');  

class CodexCrumbs{
    var $crumbs    = array();

    var $separator = ' <span class="codex-crumbs-separator">>></span> ';
    var $prefix    = '<div id="codex-crumbs">';
    var $suffix    = '</div>';

    function CodexCrumbs(){
        $this->crumbs = array();
    }

    function setSeparator($new_val){
        $this->separator = $new_val;
    }
    function setPrefix($prefix){
        $this->prefix = $prefix;
    }
    function setSuffix($suffix){
        $this->suffix = $suffix;
    }

    function add($link,$value){
        $this->crumbs[$value] = $link;
    }
    function getAsArray(){
        return $this->crumbs;
    }
    function getAsHTML(){
        $html = $this->prefix;

        $i = 1;
        foreach($this->crumbs as $value=>$link){
            $html .= anchor($link,$value);
            if($i != count($this->crumbs))
                $html .= $this->separator;
            $i++;
        }
        $html .= $this->suffix;
        return $html;    
    }
}

?>
